package com.hamster.crmpre.web;

import com.hamster.crmpre.pojo.CustomerCourseClass;
import com.hamster.crmpre.service.ApplicationStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author ：Lizhipeng
 * @date ：Created in 2020/1/2 15:17
 * @description：课程报名情况控制器
 * @modified By：
 * @version: 1.0
 */
@RestController
@RequestMapping("applicationStatus")
public class ApplicationStatusController {

    @Autowired
    private ApplicationStatusService applicationStatusService;

    /**
     * 课程报名情况获取项目标题
     * @return
     */
    @GetMapping("getStatus")
    public List<Map<String,String>> getStatus(){
        List<Map<String,String>> list = applicationStatusService.getStatus();
        return  list;
    }

    /**
     * 课程报名情况获取列表详细信息
     * @param id 项目id
     * @return map中有5种参数（手机、姓名、课程名、上课时间、下课时间）
     */
    @GetMapping("getCourseClass")
    public List<Map<String,Object>> getCourseClass(
            @RequestParam String id,
            @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") Date startTime,
            @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") Date endTime
            ){
        //返回map中有5种数据
        List<Map<String, Object>> list = applicationStatusService.getCourseClass(id,startTime,endTime);
        return list;
    }

}
